<?php
namespace app\common\model;

use think\Db;
use think\Model;

/**   YSF
 *    意见反馈 模型
 *    Date: 2018/9/6
 * Class OpinionFeedbackModel
 * @package app\common\model
 */
class OpinionFeedbackModel extends Model
{
    // 表名
    protected $name = 'opinion_feedback';

    // 连表列表查询
    public function getJoinAll($where=[], $join, $page=1, $pageSize=100, $field='*', $order='')
    {
        $result = Db::name($this->name)
            ->alias('a')
            ->where($where)
            ->join($join)
            ->field($field)
            ->page($page,$pageSize)
            ->order($order)
            ->select();
        return $result;
    }

    // 连表数量统计
    public function getJoinCount($where, $join)
    {
        $result = Db::name($this->name)
            ->alias('a')
            ->where($where)
            ->join($join)
            ->count();
        return $result;
    }

    // 连表单条
    public function getJoinOne($where, $join, $field)
    {
        $result = Db::name($this->name)
                ->alias('a')
                ->where($where)
                ->join($join)
                ->field($field)
                ->find();
        return $result;
    }
    
}